/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package UI;

import java.awt.Color;
import java.awt.Component;
import java.awt.Graphics;
import java.awt.event.MouseEvent;
import java.awt.event.MouseListener;
import java.awt.event.MouseMotionListener;
import javax.swing.JLabel;
import javax.swing.JOptionPane;

/**
 *
 * @author Marco
 */
public class papota extends JLabel implements MouseListener, MouseMotionListener {
    
    int x,y;
    int xx,yy;

    public papota() {
        this.x = 600;
        this.y = 600;
    }
    
public void paintComponent(Graphics g){
     super.paintComponent(g);
    // this.setSize(40, 40);

            g.setColor(Color.RED);
       
            g.fillOval(0, 0, 30, 30);
            g.setColor(Color.BLUE);
            //dibujo el peso del nodo 
            g.drawString(""+1, -15, -15);
            
            g.setColor(Color.BLACK);
            //Dibujo el numero de nodo en el centro
         
            g.drawString(""+2, -2, +4);
            this.addMouseListener(this);
            this.addMouseMotionListener(this);
}
    
    @Override
    public void mouseClicked(MouseEvent e) {
 
    }

    @Override
    public void mousePressed(MouseEvent e) {
       
    }

    @Override
    public void mouseReleased(MouseEvent e) {
    }

    @Override
    public void mouseEntered(MouseEvent e) {
        
    }

    @Override
    public void mouseExited(MouseEvent e) {
       
    }

    @Override
    public void mouseDragged(MouseEvent e) {
        
     //   this.setLocation(this.getX()+e.getX()-this.getWidth()/2,this.getY()+e.getY()-this.getHeight()/2);
        //arreglar para que sea idnependiente del tamaño d elo que lo contiene
      this.setLocation( e.getLocationOnScreen());
      
     
        
        //this.repaint();;
    }

    @Override
    public void mouseMoved(MouseEvent e) {
       
    }
    
}
